#pragma once

#include <vector>
#include "config.h"
using namespace std;

class Modifies{
public:
	/** Constructor
	 * Creates an empty Modifies table
	 */
	Modifies();

	/**
	 * Add a Modifies relationship of a statement modifying a variable of a specific variable number.
	 * @param stmtNum the statement number of the modifying statement
	 * @param varIndex the index of the variable being modified.
	 * @return the index of newly added Modifies relationship, -1 if unsuccessful.
	 */
	int addStmtModifies(int stmtNum, int varIndex);

	/**
	 * Add a Modifies relationship of a procedure modifying a variable of a specific variable number.
	 * @param procIndex the index of the modifying procedure.
	 * @param varIndex the index of the variable being modified.
	 * @return the index of newly added Modifies relationship, -1 if unsuccessful.
	 */
	int addProcModifies(int procIndex, int varIndex);

	/**
	 * Get a list of matching statement numbers and variable numbers.
	 * @param stmtNumber statement number of modifying statement, can be ANYVALUE.
	 * @param varIndex the index of variable being modified, can be ANYVALUE.
	 * @return a vector of pairs that satisfies the criteria, empty if none satisfies.
	 */
	vector<pair<int, int>> getModifiesStatement(int stmtNumber, int varIndex);

	/**
	 * Get a list of matching procedure numbers and variable numbers.
	 * @param procIndex index of the modifying procedure, can be ANYVALUE.
	 * @param varIndex the index of variable being modified, can be ANYVALUE.
	 * @return a vector of pairs that satisfies the criteria, empty if none satisfies.
	 */
	vector<pair<int, int>> getModifiesProcedure(int procIndex, int varIndex);

private:
	vector<pair<int, int>> modifiesStmtIndex; /**< A Modifies table that contains all pairs of variable modifications by statements */
	vector<pair<int, int>> modifiesProcIndex; /**< A Modifies table that contains all pairs of variable modifications by procedures */
};

